#ifndef __EXPANDSERVER_H_
#define __EXPANDSERVER_H_

#include "common.h"
#include "network.h"
#include "scanner.h"
#include "configfile.h"
#include "DistrbuteCard.h"
#include "CardClip.h"

#define DEFAULT_EXPAND_DEV  "/dev/ttyUSB0"
#define DEFAULT_EXPAND_RATE  460800
#define DEFAULT_UART_READ_SIZE 4096

enum CardStatus
{
	WORK_STATUS,
	UNWORK_STATUS,
};

typedef struct __UartInfo
{

	char devname[64];
	int baudrate;
	int uartfd;
	char *readbuf;
	pthread_t uartpid;
	pthread_mutex_t uartWriteMutex;
	pthread_mutex_t uartReadMutex;
	ParseData * UartParse;
}UartInfo;

#define 	PANNEL_BUFFER_SIZE   			1024
#define   	PROTOCAL_SEQUENCE_LENGTH    8
#define 	PARSE_SUCCESSFUL  		1000
#define 	PANNEL_PUSH   	   		0x01
#define 	PANNEL_PULL   	   		0x03
#define 	PANNEL_MODE_FULL   		0X00
#define 	PANNEL_MODE_HALF   		0X03



typedef struct pannel_info
{
	char   sv_cmd;
	int    sv_state;
	int    sv_com;
	int    sv_count;
	int    framereq;
	int    sv_len;
	int    msgcnt;
	char   msginfo[4];
	int    writebuflen;
	unsigned char 	cmdtype;
	unsigned char   *ss_buf;
	unsigned char   *writebuf;
	unsigned char   *readbuf;
	unsigned short sv_crc;
}TsPannel;

int PannelDevInit(int *com,char *COM,int Baudrate);
int PannelHeartBeat(int com);
int PannelMemInit(void);
int PannelMemFree(void);
int SetPaperPrint(int status);
int PaperDevInit(int *com,char *DeviceName,unsigned int  Baudrate,int loglevel);
int  PrintBarCode(int paperfd,unsigned char *pData,unsigned char pDataLen,unsigned char id,unsigned char enable);
int  PrintGratinmap(int paperfd,unsigned char mode,unsigned int xDot,unsigned int yDot,unsigned char *pData,unsigned char id,unsigned char enable);
int  TestPrintPage(int paperfd,unsigned char id,unsigned char enable);
int PrintQRCode(int paperfd,unsigned char * StrCode, int Len,unsigned char id,unsigned char enable);
int GetPrintStatus(int hmifd,int paperfd,uint16_t addr,int delayms,unsigned char id);
int PrintString(int com,char* StrToPrint, int len);

#endif 
